*******************************************
**** Empathy Project Dynata Sample 2021 ***
*******************************************

* Fielded 8/18/21 - 8/20/21
* Nathan Brophy and Kevin Mullinix 2023
* File last updated: 7/25/2023

* Stata 17 SE packages used: 
* estout from http://fmwww.bc.edu/repec/bocode/e
* asdoc from http://fmwww.bc.edu/repec/bocode/a
* grc1leg from https://www.stata.com/statalist/archive/2003-06/msg00348.html
* interflex from https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2739221

* Clear Stata
clear 

*Use data file: "Dynata2021_Dataverse.dta"

************************
* VARIABLE PREPARATION *
************************

*** Experimental Conditions for Convict vs. Citizen
tab Kevin_Group

gen group=.
replace group=0 if Kevin_Group=="KevinControl"
replace group=1 if Kevin_Group=="KevinTreat"
tab group
label define group 0 "Control" 1 "Empathy Treat"
label values group group
tab group


*** Empathy measures
*Note: higher values indicate higher empathy

*To what extent do you agree or disagree with the following statements (1 disagree to 4 agree)

*Q19 I am quick to spot when someone in a group is feeling awkward or uncomfortable.
tab Q19
gen emp1=Q19
tab emp1

*Q20 I can tell if someone is masking their true emotion.
tab Q20
gen emp2=Q20
tab emp2

*Q21 People sometimes tell me that I have gone too far with teasing. Reversed
tab Q21
gen emp3=5-Q21
tab emp3


*Q22 I often find it difficult to judge if something is rude or polite. Reversed
tab Q22
gen emp4=5-Q22
tab emp4

*Q23 Seeing other people cry doesn't really upset me. Reversed
tab Q23
gen emp5=5-Q23
tab emp5

*Q24 I can easily tell if someone else wants to enter a conversation.
tab Q24
gen emp6=Q24
tab emp6

*Q82 Friends usually talk to me about their problems as they say that I am very understanding.
tab Q82
gen emp7=Q82
tab emp7

*Q83 Friendships and relationships are just too difficult, so I tend not to bother with them. Reversed
tab Q83
gen emp8=5-Q83
tab emp8

*Empathy index
gen empadd=emp1+emp2+emp3+emp4+emp5+emp6+emp7+emp8
tab empadd

gen empavg=empadd/8
tab empavg

egen empstd = std(empavg)
tab empstd


*** Demographics

*Ideology
*Q81 How would you describe your political views? 1 extremely liberal, 7 extremely conservative, 8 unsure
tab Q81
gen ideo=Q81
replace ideo=. if Q81==8
tab ideo

gen ideo2=.
replace ideo2=0 if ideo==1
replace ideo2=0 if ideo==2
replace ideo2=0 if ideo==3
replace ideo2=1 if ideo==5
replace ideo2=1 if ideo==6
replace ideo2=1 if ideo==7
tab ideo2
label define ideo2 0 "Liberal" 1 "Conservative"
label values ideo2 ideo2
tab ideo2

gen ideo3=.
replace ideo3=0 if ideo==1
replace ideo3=0 if ideo==2
replace ideo3=0 if ideo==3
replace ideo3=1 if ideo==4
replace ideo3=2 if ideo==5
replace ideo3=2 if ideo==6
replace ideo3=2 if ideo==7
tab ideo3
label define ideo3 0 "Liberal" 1 "Moderate" 2 "Conservative"
label values ideo3 ideo3
tab ideo3

*Age
*Q84 What is your age in years?
tab Q84
gen age=Q84
replace age=. if Q84==999
tab age

*Sex
*Q85 What sex were you assigned at birth, on your original birth certificate?
*1 male, 2 female
tab Q85
gen sex=Q85
tab sex

*Gender
*Q86 Do you currently describe yourself as male, female, or transgender?
*1 male, 2 female, transgender, 3 none of these
tab Q86
gen gender=.
replace gender=1 if Q86==1
replace gender=2 if Q86==2
replace gender=3 if Q86==3
replace gender=3 if Q86==4
tab gender

*Education
*Q87 What is the highest level of education you have completed?
tab Q87
gen edu=Q87
tab edu

*race and ethnicity
*Q89 If you had to choose, what would you say is your race? Check all that apply. 
tab Q89
gen race5=.
replace race5=0 if Q89=="1"
replace race5=1 if Q89=="2"
replace race5=2 if Q89=="4"
replace race5=3 if Q89=="6"
replace race5=4 if Q89=="1,2"
replace race5=4 if Q89=="1,2,3"
replace race5=4 if Q89=="1,2,6"
replace race5=4 if Q89=="1,3"
replace race5=4 if Q89=="1,3,6,7"
replace race5=4 if Q89=="1,4"
replace race5=4 if Q89=="1,6"
replace race5=4 if Q89=="1,7"
replace race5=4 if Q89=="2,3"
replace race5=4 if Q89=="2,6"
replace race5=4 if Q89=="3"
replace race5=4 if Q89=="4,5"
replace race5=4 if Q89=="4,6"
replace race5=4 if Q89=="5"
replace race5=4 if Q89=="5,6"
replace race5=4 if Q89=="7"
tab race5
label define race5 0 "Non-Hispanic White" 1 "Non-Hispanic Black" 2 "Asian" 3 "Hispanic or Latino only" 4 "All other"
label values race5 race5 
tab race5


*Income
*Q94 Last year (2020), what was your total family income from all sources, before taxes? 
tab Q94
gen income=Q94
tab income


*Political knowledge
*Note that I used a prompt to reduce looking up answers. Q75 It is important to use that you do NOT use outside sources like the internet to search for the correct answer. Will you answer the following questions without help from outside sources?

tab Q76
gen pk1=.
replace pk1=1 if Q76==2
replace pk1=0 if Q76==1
replace pk1=0 if Q76==3
replace pk1=0 if Q76==4
replace pk1=0 if Q76==5
tab pk1

tab Q77
gen pk2=.
replace pk2=1 if Q77==4
replace pk2=0 if Q77==1
replace pk2=0 if Q77==2
replace pk2=0 if Q77==3
replace pk2=0 if Q77==5
tab pk2

tab Q78
gen pk3=.
replace pk3=1 if Q78==2
replace pk3=0 if Q78==1
replace pk3=0 if Q78==3
replace pk3=0 if Q78==4
tab pk3

tab Q79
gen pk4=.
replace pk4=1 if Q79==2
replace pk4=0 if Q79==1
replace pk4=0 if Q79==3
tab pk4

gen pkadd=pk1+pk2+pk3+pk4
tab pkadd

*Partisanship
*Q98 Do you consider yourself a Republican, Democrat, or Independent, or what?

*Strong Democrat  (1) 
*Democrat  (2) 
*Independent leaning Democratic  (3) 
*Independent (don't lean toward either party)  (4) 
*Independent leaning Republican  (5) 
*Republican  (6) 
*Strong Republican  (7) 
*Other  (99) 
tab Q98
gen party2=.
replace party2=0 if Q98==1
replace party2=0 if Q98==2
replace party2=0 if Q98==3
replace party2=1 if Q98==5
replace party2=1 if Q98==6
replace party2=1 if Q98==7
tab party2
label define party2 0 "Democrats" 1 "Republicans"
label values party2 party2
tab party2


*****************************
* Dependent Policy Measures *
*****************************

*Q11 Do you support or oppose legislation that would allow the federal government to negotiate with drug companies (for both Medicare and private insurance) to lower prices on necessary prescription drugs, such as insulin for diabetes?
*1 strongly oppose to 7 strongly support
tab Q11
gen drug=Q11
tab drug


*Q12 Do you support or oppose of the 2010 Affordable Care Act, also known as “Obamacare"?
*1 strongly oppose to 7 strongly support
tab Q12
gen obamacare=Q12
tab obamacare


*Q13 The federal government currently provides unemployed workers with $300 a week on top of their regular unemployment benefits. The extra benefits are scheduled to end in September. Some people say the benefits are discouraging people from working and making it hard for companies to hire. Other people say they are helping unemployed workers by letting them avoid jobs that are unsafe or that pay too little. 
*The additional unemployment benefits should end now  (1) 
*The additional unemployment benefits should continue until September  (2) 
*The additional unemployment benefits should continue indefinitely  (3) 
tab Q13
gen unemp=Q13
tab unemp


*Q14 On any given day, more than 60,000 incarcerated adults will be held in solitary confinement in the United States. These inmates are confined to their cells between 20-22 hours a day with limited access to programs, services, and general human contact. Do you support or oppose the use of solitary confinement as punishment in prisons?
*1 strongly oppose to 7 strongly support
tab Q14
gen solitary=Q14
tab solitary


*Q15 Do you think it should be legal or illegal to give water to people waiting in line to vote?
*It should be legal to give water  (1) 
*It should be illegal to give water  (2) 
*I'm going to reverse code this one and make it 0 and 1
tab Q15
gen water=.
replace water=0 if Q15==2
replace water=1 if Q15==1
tab water


*Q16 Do you think it should be easier or harder for people to vote in American elections than it is currently?
*1 much easier to 5 much harder
tab Q16
gen voteharder=Q16
tab voteharder

 
* Q17/18 Randomized to receive citizen/convict treatment on voting. Allowing felons to vote. 
* Note: people randomized to receive either Q17 or Q18. Randomization variable is KevinVote
tab Q17
tab Q18

gen felondis=.
replace felondis=1 if Q17==1
replace felondis=2 if Q17==2
replace felondis=3 if Q17==3
replace felondis=4 if Q17==4
replace felondis=5 if Q17==5
replace felondis=6 if Q17==6
replace felondis=7 if Q17==7
replace felondis=1 if Q18==1
replace felondis=2 if Q18==2
replace felondis=3 if Q18==3
replace felondis=4 if Q18==4
replace felondis=5 if Q18==5
replace felondis=6 if Q18==6
replace felondis=7 if Q18==7
tab felondis

tab KevinVote
gen felongroup=.
replace felongroup=0 if KevinVote=="KevinCitizen"
replace felongroup=1 if KevinVote=="KevinConvict"
tab felongroup
label define felongroup 0 "Citizen Control" 1 "EConvict"
label values felongroup felongroup
tab felongroup
tab felondis

*Q100 Do you favor capital punishment, life imprisonment with no possibility for parole, or imprisonment with the possibility of parole for murderers?
*Capital punishment (the death penalty)  (1) 
*Life imprisonment without the possibility of parole  (2) 
*Imprisonment with the possibility of parole at some point in time  (3) 

*reversed
tab Q100
gen death=4-Q100
tab death


*Q101 Do you support or oppose the recent removal of U.S. troops from Afghanistan?
*1 strongly oppose to 7 strongly support
tab Q101
gen afghantroops=Q101
tab afghantroops


*Q102 Should the United States help Afghans resettle in the U.S. if they want to leave Afghanistan?
*Yes 1
*No 2
*reverse
tab Q102 
gen afghanresettle = 3-Q102 // Recodes to (Yes = 2) and (No = 1)
replace afghanresettle = afghanresettle - 1 // Recoding so (Yes = 1) and (No = 0) for logit model
tab afghanresettle


STOP 

**************************************************
* Main Paper Figure 1: Predicted probability plots 
**************************************************

* See distribution of Empavg
hist empavg //Looks like hardly anyone aroudn 1-1.5. Start scale at 2

* Drug Prices
regress drug c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4)) vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Drugs") xtitle("Empathy", margin(medium)) 
graph save DrugsParty2, replace

* ACA
regress obamacare c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4)) vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("ACA") xtitle("Empathy", margin(medium)) 
graph save ACAParty2, replace

* Unemployment Payments
regress unemp c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4))vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Unemployment") xtitle("Empathy", margin(medium))
graph save UnempParty2, replace

* Solitary Confinement
regress solitary c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4)) vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Solitary") xtitle("Empathy", margin(medium))
graph save SolitaryParty2, replace

* Giving Water to Voters
logit water c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4))vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Water") xtitle("Empathy", margin(medium))
graph save WaterParty2, replace
* NOTE: this is a logit model

* Make Voting Harder
regress voteharder c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4)) vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Voting") xtitle("Empathy", margin(medium))
graph save VoteParty2, replace

* Felons/Citizens Voting
regress felondis c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4))vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Felons") xtitle("Empathy", margin(medium))
graph save FelonsParty2, replace

* Death Penalty
regress death c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4))vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Death") xtitle("Empathy", margin(medium))
graph save DeathParty2, replace

* Remove Troops from Afghanistan
regress afghantroops c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4))vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Troops") xtitle("Empathy", margin(medium))
graph save TroopsParty2, replace 

* Afghan Refugee Resettlement
logit afghanresettle c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup i.party2#c.empavg
margins i.party2, at(empavg=(2 2.5 3 3.5 4))vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Resettle") xtitle("Empathy", margin(medium))
graph save ResettleParty2, replace 
* NOTE: this is a logit model


* Combined graphs with single legend
* We reorder these based on calculated partsian gap on issues. Thus, the ordering goes from those issues with the greatest "gap" to those issues with the smallest "gap". To calculate our partisan gap, we simply took average score for republicans minus average score for democrats divided by the scale of the dependent variable in order to standardize them.

grc1leg "ACAParty2" "VoteParty2" "UnempParty2" "FelonsParty2" "TroopsParty2" "ResettleParty2" "DeathParty2" "SolitaryParty2" "DrugsParty2" "WaterParty2", xcommon row(2) col(5) title("Marginal Effects Panel") legendfrom ("ResettleParty2") 

***********************************************
* Main Paper Appendix (as they appear in order)
***********************************************

* Appendix Table 1 [Empathy Independent Effects]
eststo clear
eststo: quietly regress drug c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress obamacare c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress unemp c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress solitary c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly logit water c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress voteharder c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress felondis c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup  
eststo: quietly regress death c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup  
eststo: quietly regress afghantroops c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly logit afghanresettle c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
esttab using AppendixTable1.rtf, se(3) b(3) title(Study1Table1) nogaps star(* .1 ** .05 *** .01) scalars (r2) nonumbers compress onecell modelwidth(5) indicate (Controls = age 1.gender 2.gender 3.gender edu 0.race5 1.race5 2.race5 3.race5 4.race5 income pkadd 0.felongroup 1.felongroup) replace 

* Appendix Figure 1: Interflex Linear Marginal Effects 
xi: interflex drug i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Drugs)
graph save iflexLdrug, replace

xi: interflex obamacare i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(ACA)
graph save iflexLACA, replace

xi: interflex unemp i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Unemployment)
graph save iflexLunemp, replace

xi: interflex solitary i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Solitary Confinement)
graph save iflexLsolitary, replace

xi: interflex voteharder i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Voting Harder)
graph save iflexLvoteharder, replace

xi: interflex water i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Giving Water) 
graph save iflexLwater, replace

xi: interflex felondis i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Felony Disenfranchisement)
graph save iflexLfelondis, replace

xi: interflex death i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Death Penalty)
graph save iflexLdeath, replace

xi: interflex afghantroops i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Sending Troops)
graph save iflexLafghantroops, replace

xi: interflex afghanresettle i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(linear) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Resettle)
graph save iflexLafghanresettle, replace

graph combine iflexLACA.gph iflexLvoteharder.gph iflexLunemp.gph iflexLfelondis.gph iflexLafghantroops.gph iflexLafghanresettle.gph iflexLdeath.gph iflexLsolitary.gph iflexLdrug.gph iflexLwater.gph, rows(2)

* Appendix Figure 2: Interflex Non-Linear Marginal Effects 
xi: interflex drug i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Drugs)
graph save iflexNLdrug, replace

xi: interflex obamacare i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(ACA)
graph save iflexNLACA, replace

xi: interflex unemp i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Unemployment)
graph save iflexNLunemp, replace

xi: interflex solitary i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Solitary Confinement)
graph save iflexNLsolitary, replace

xi: interflex voteharder i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Voting Harder)
graph save iflexNLvoteharder, replace

xi: interflex water i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Giving Water)
graph save iflexNLwater, replace

xi: interflex felondis i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Felony Disenfranchisement)
graph save iflexNLfelondis, replace

xi: interflex death i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Death Penalty)
graph save iflexNLdeath, replace

xi: interflex afghantroops i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Sending Troops)
graph save iflexNLafghantroops, replace

xi: interflex afghanresettle i.party2 empavg age i.gender edu i.race5 income pkadd i.group i.felongroup, type(kernel) xd(density) ylab(Policy Support) dlab(Party) xlab(Empathy) title(Resettle)
graph save iflexNLafghanresettle, replace

graph combine iflexNLACA.gph iflexNLvoteharder.gph iflexNLunemp.gph iflexNLfelondis.gph iflexNLafghantroops.gph iflexNLafghanresettle.gph iflexNLdeath.gph iflexNLsolitary.gph iflexNLdrug.gph iflexNLwater.gph, rows(2)

***************************************************************
* Analyses for Supplemental Materials (as they appear in order)
***************************************************************

* Sample statistics on key demographics
summarize gender age edu income race5 ideo3 

* Empathy distribution and histograms
hist empavg if party2==0, normal title(EQ Score Distribution: Democrats) 
hist empavg if party2==1, normal title(EQ Score Distribution: Republicans) 

* OLS Full results [no interaction]
eststo clear
eststo: quietly regress drug c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress obamacare c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress unemp c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress solitary c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly logit water c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress voteharder c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly regress felondis c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup  
eststo: quietly regress death c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup  
eststo: quietly regress afghantroops c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly logit afghanresettle c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
esttab using Study1Table1Supp.rtf, se(3) b(3) title(Study1Table1) nogaps star(* .1 ** .05 *** .01) scalars (r2) nonumbers compress onecell modelwidth(5) replace 

* OLS Full results with interaction
eststo clear
eststo: quietly regress drug c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly regress obamacare c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly regress unemp c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly regress solitary c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly logit water c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly regress voteharder c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly regress felondis c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup  
eststo: quietly regress death c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup  
eststo: quietly regress afghantroops c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup  
eststo: quietly logit afghanresettle c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg  i.group i.felongroup 
esttab using Study1Table2Supp.rtf, se(3) b(3) title(Study 1 Conditional Effects of Empathy on Policy Attitudes, (OLS, interaction with party) (Dynata)) nogaps star(* .1 ** .05 *** .01) scalars(r2) nonumbers compress onecell modelwidth(5) 

* Effect of Treatment on Emapthy Index
tabulate empavg group, chi2 //chi square results indicate no difference in treatment/control
regress empavg i.group //basic bivariate relationship
eststo clear
eststo: regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group //assignment to treatment group has little effect on empathy index. Treatment most likely failed. 
esttab using Study1Table3Supp.rtf, se(3) b(3) title(Effect of Treatment on Empathy Index (Dynata)) nogaps star(* .1 ** .05 *** .01) scalars (r2) nonumbers compress onecell modelwidth(5) replace

* Ordered Logit Independent Effects [no interaction]
eststo clear
eststo: quietly ologit drug c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly ologit obamacare c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly ologit unemp c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly ologit solitary c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly logit water c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly ologit voteharder c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
eststo: quietly ologit felondis c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup  
eststo: quietly ologit death c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup  
eststo: quietly ologit afghantroops c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup  
eststo: quietly logit afghanresettle c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup 
esttab using Study1Table4Supp.rtf, se(3) b(3) title(Study 1 Effects of Empathy on Policy Attitudes, (ordered logit, no interaction) (Dynata)) nogaps star(* .1 ** .05 *** .01) scalars (r2_p) nonumbers compress onecell modelwidth(5) replace 

* Ordered Logit with interaction 
eststo clear
eststo: quietly ologit drug c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup
eststo: quietly ologit obamacare c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly ologit unemp c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly ologit solitary c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly logit water c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly ologit voteharder c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup 
eststo: quietly ologit felondis c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup  
eststo: quietly ologit death c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup  
eststo: quietly ologit afghantroops c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg i.group i.felongroup  
eststo: quietly logit afghanresettle c.empavg i.party2 age i.gender edu i.race5 income pkadd i.party2#c.empavg  i.group i.felongroup 
esttab using Study1Table5Supp.rtf, se(3) b(3) title(Study 1 Conditional Effects of Empathy on Policy Attitudes, (ordered logit, interaction with party) (Dynata)) nogaps star(* .1 ** .05 *** .01) scalars(r2_p) nonumbers compress onecell modelwidth(5) replace

* Affective Polarization and Feeling Thermometers 
tab Q80_2 // feeling thermometer for Dems
tab Q80_4 // feeling thermometer for Reps

gen FeelDem = Q80_2
tab FeelDem

gen FeelRep = Q80_4
tab FeelRep

eststo clear
eststo: quietly regress FeelDem c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.party2#c.empavg
esttab using FeelingThermDem.rtf, se(3) b(3) title(FeelingThermDem) nogaps star(* .1 ** .05 *** .01) scalars (r2) nonumbers compress label replace

margins i.party2, at(empavg=(1.5 2 2.5 3 3.5 4)) vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Predicted Feelings For Democrats")   xtitle("Empathy", margin(medium)) ytitle("Predicted Feelings for Democrats", margin(medium)) 

eststo clear
eststo: quietly regress FeelRep c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.party2#c.empavg
esttab using FeelingThermRep.rtf, se(3) b(3) title(FeelingThermRep) nogaps star(* .1 ** .05 *** .01) scalars (r2) nonumbers compress label replace

margins i.party2, at(empavg=(1.5 2 2.5 3 3.5 4)) vsquish
marginsplot, recast(line) recastci(rarea)  graphregion(color(white)) title ("Predicted Feelings For Republicans")   xtitle("Empathy", margin(medium)) ytitle("Predicted Feelings for Republicans", margin(medium))

//These models act like we would expect partisan motivated empathy. Highly emapthic democrats are more likely to show warm feelings for democrats. In contrast, highly empathic democrats feel much more coldly about republicans. Same as study #2. 


* Medidation Analysis 

* medeff from http://fmwww.bc.edu/RePEc/bocode/m/medeff.html
* We conduct mediation analysis in two ways: (1) using generalized structural equation modeling (gsem), 
* and (2) causal mediation analysis (medeff) following Imai et al. (2010). Below we run both processes for all 10 policies.

* Allowing the government to negotiate drug prices
gsem (drug <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[drug:empavg]*_b[empavg:1.party2] // using nlcom to find indirect effects because "estat teffects" does not work with gsem.
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (regress drug empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

*Obamacare
gsem (obamacare <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[obamacare:empavg]*_b[empavg:1.party2]
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (regress obamacare empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

* Unemployment
gsem (unemp <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[unemp:empavg]*_b[empavg:1.party2]
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (regress unemp empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

* Solitary confinement
gsem (solitary <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[solitary:empavg]*_b[empavg:1.party2]
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (regress solitary empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

* Giving water to voters
gsem (water <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[water:empavg]*_b[empavg:1.party2]
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (logit water empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

* Making it harder to vote
gsem (voteharder <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[voteharder:empavg]*_b[empavg:1.party2]
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (regress voteharder empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

* Felony disenfranchisement
gsem (felondis <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[felondis:empavg]*_b[empavg:1.party2]
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (regress felondis empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

* Death penalty
gsem (death <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[death:empavg]*_b[empavg:1.party2]
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (regress death empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

* Removing troops from Afghanistan
gsem (afghantroops <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[afghantroops:empavg]*_b[empavg:1.party2]
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (regress afghantroops empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

* Resetlling Afghan refugees
gsem (afghanresettle <- c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (c.empavg <- i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup)
gsem, coeflegend
nlcom _b[afghanresettle:empavg]*_b[empavg:1.party2]
xi: medeff(regress empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup) (logit afghanresettle empavg i.party2 age i.gender edu i.race5 income pkadd i.group i.felongroup), mediate(empavg) treat(i.party2)

* Interaction between treatment and EQ   
eststo clear
eststo: quietly regress drug c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg i.group i.felongroup 
eststo: quietly regress obamacare c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg i.group i.felongroup 
eststo: quietly regress unemp c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg i.group i.felongroup 
eststo: quietly regress solitary c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg i.group i.felongroup 
eststo: quietly logit water c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg i.group i.felongroup 
eststo: quietly regress voteharder c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg i.group i.felongroup 
eststo: quietly regress felondis c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg i.group i.felongroup  
eststo: quietly regress death c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg i.group i.felongroup  
eststo: quietly regress afghantroops c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg i.group i.felongroup  
eststo: quietly logit afghanresettle c.empavg i.party2 age i.gender edu i.race5 income pkadd i.group#c.empavg  i.group i.felongroup 
esttab using Study1Table6Supp.rtf, se(3) b(3) title(Study 1 EQ and Treatment Interaction) nogaps star(* .1 ** .05 *** .01) scalars(r2 r2_p) nonumbers compress onecell modelwidth(5) //we would expect by chance to find some significant result, investigating the only significant result we have (felondis) reveals there isn't really much of a relationship even when looking at the marginal effects plots. Our treatment had no effect on dispositional empathy. 















